using System;
using HgAdapter;
using HogoLogic.HgFileSystem;

namespace FileSystemView.SelectedFsElements
{
	class SelectedFile : SelectedFsElement
	{
		string filePath;
		VersionStatus versionStatus;
		
		public SelectedFile(HgFileInfo fileInfo)
		{
			filePath = fileInfo.RelativeFullName;
			versionStatus = fileInfo.VersionStatus;
		}

		public override bool CanBeAdded
		{
			get
			{
				return versionStatus == VersionStatus.Unversioned;
			}
		}

		public override bool CanBeComitted
		{
			get
			{
				return versionStatus == VersionStatus.Changed ||
					versionStatus == VersionStatus.Added;
			}
		}
		
		public override bool CanBeAnnotated
		{
			get
			{
				return versionStatus == VersionStatus.Unchanged || 
				       versionStatus == VersionStatus.Changed;
			}
		}

		public override bool CanBeDiffed
		{
			get
			{
				return versionStatus == VersionStatus.Changed;
			}
		}

		public override bool CanBeOpened
		{
			get
			{
				return true;
			}
		}

		public override string BrackedFileName
		{
			get
			{
				return "\"" + filePath + "\"";
			}
		}
	}
}
